var keyMap = {};
var pageid  = location.search.substring(1);
pageid.split('&').forEach(function(element){
    var km = element.split('=');
    keyMap[km[0]]= km[1];
},this);
$(function(){
    console.log(keyMap);
    $.get('http://127.0.0.1:3000/api/getdiscountproduct',{productid:keyMap.productid},function(data){
        console.log(data);
        data = data.result[0];
        // console.log(data);
        var item = $('.Item').clone(true);
        $('.Item').remove();
        var productName = data.productName.split(" ");
        var sizes = productName.pop(),arr;
        arr = productName.concat();
        console.log(arr);
        // console.log(productName);
        item.find('.productfeature').text(arr);
        item.find('.sizes').text(sizes);
        item.find('product_feature').html(data.productFrom+'&nbsp'+data.productTime+'&nbsp'+data.productTips);
        item.find('.productPrice').text(data.productPrice)
        item.find('.bigImg').html(data.productImgLg);
        item.find('.productCity').html(data.productCity);
        $('.Item_con').append(item);
        $('.tocomm').html(data.productComment);
        $('.form textarea').attr('class','textarea');
    })
    
})